package com.qyer.search.threading;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.ForkJoinPool;

/**
 * Created by tangzheng on 16/5/17.
 */

public class SortingThreadPoolHolder extends AbstractThreadPoolHolder {

  private static final Logger LOGGER = LoggerFactory.getLogger(SortingThreadPoolHolder.class);

  private static class InnerHolder {

    private static final SortingThreadPoolHolder INSTANCE = new SortingThreadPoolHolder();
  }

  private SortingThreadPoolHolder() {
    LOGGER.info("Default sorting thread pool has been built.");
    this.service = new ForkJoinPool();
    this.name = "DEFAULT-SORTING-FORK-JOIN-POOL";
  }

  public static final SortingThreadPoolHolder getInstance() {
    return InnerHolder.INSTANCE;
  }

  public ForkJoinPool getForkService() {
    return (ForkJoinPool) getService();
  }

}

